import express from 'express';
import { AuthController } from '../controllers/auth.controller';
import { asyncHandler } from '../middlewares/asyncHandler';
import { authenticate } from '../middlewares/authenticate';

const router = express.Router();
const authController = new AuthController();

// 账号密码登录
router.post('/login', asyncHandler(authController.login));

// 修改密码(需要认证)
router.post('/change-password', authenticate, asyncHandler(authController.changePassword));

// 重置密码(需要管理员权限)
router.post('/reset-password', authenticate, asyncHandler(authController.resetPassword));

// 企业微信登录相关路由
router.get('/wework/login-url', asyncHandler(authController.getLoginUrl));
router.get('/wework/callback', asyncHandler(authController.handleCallback));

export default router; 